CS 432-Fall 2001

Assignment 6

Transaction Simulation & Crash Recovery
Due Date: December 4, 23:59pm.

 

Note: You will not have to write a lot of code for this assignment, but there are many small details to take care of when writing an ARIES-style recovery manager. I strongly suggest that you start soon. In addition, it is very worthwhile to write pseudo-code before you start coding, and to make sure that you understand all the different components of the assignment. You will do this assignment in groups of two students.

Introduction

In this assignment you will complete certain parts of a database engine. The database is modeled very simply, and runs by executing a series of transaction operations given to it by the user. Each transaction performs a series of reads and writes on the pages of the database, and can commit or abort at any time.

The simulator keeps a recovery manager module that keeps a log of the database's activity. At any point in time, the database may crash (specifically, when it encounters a special command to induce a crash). The recovery manager then performs a restart to restore the database to a correct state, using the Aries recovery algorithm.


The Transaction Simulator

The transaction simulator works just like a mini-database. There is a series of pages stored in a file on disk, accessed through a buffer. Transactions are modeled as a sequence of reads and writes to the pages of the database. A log is kept of all changes to database pages, with WAL used to insure that committed transactions are fully represented by the log as written to stable storage. Checkpoints can be inserted at will.

This assignment uses an application called MARS which is a GUI for testing the simulator. The input comes from .mars files that can be found in the folder Tests. These files can be edited using any simple text editor. The syntax for commands to the simulator is discussed in Getting Started with the Simulator.

A breakdown of the major components follows:

The recmgr_tab.c module is responsible for parsing the input. It is computer generated, and not very fit for modification. Don't worry too much about what it does; just know that it takes one command at a time from the standard input (which we might have redirected to point to a file) and converts it into a database operation.

The handle.cpp module contains the standalone functions for performing the commands. There's one for each operation, and are the "top-level" functions that are first called when an operation is done. The functions in handle.cpp are the functions that will call the Recovery Manager functions that you will be finishing, and will pass in the relevant data about the operations.

The complete code is available in the \\goose\cs432-fall01\a6 and it consists of the complete project file. You can open it by double clicking the Mars.dsw file. All you need to do is fill in gaps inside two source files (logfunc.cpp and restart.cpp) in the project.

When you have included your modification and are ready to test your code, you can run the Mars.exe file generated by visual studio when you compile the project. When you are generating the Mars.exe file it is recommended that you build the release version of the project. This can be done by opening the Build menu, selecting "Set Active Configuration", and choose "Release". The .exe file can then be found in the "Release" folder. Simply double click it to start the transaction manager.


Your Task

You will implement various pieces of the recovery module. Specifically, you will implement the functionality to handle the most basic and common of transactions, the write (WriteUpdateLog()). You must add code to the logging mechanism so that writes (also called updates) to the pages of the DB are reflected in the log, and then implement those parts of the restart mechanism that deal specifically with those log entries to restore the database to a consistent state.

The code you will write belongs in these modules:


Reference

The following pages provide more detailed explanations about the classes and types that will be useful for this assignment.


Minor Bugs


Tips

 


Submission procedure

How and what to hand in:

Keep a copy of the project in your own account just in case.


Grading

  1. 70% Correctness
  2. 20% Documentation
  3. 10% Coding Style